<template>
	<view class="content">
		归还入库
	</view>
</template>

<script setup>
	import {ref,reactive,onMounted} from "vue";
	import {GetStockInList} from '@/api/wm/stockin.js'
	import {onReachBottom,onPullDownRefresh} from '@dcloudio/uni-app'
	import search from "@/components/search.vue"
	import tjzz from "@/components/tjzz.vue"

	const common = reactive({})

	const pageList = reactive({
		dataList: [],
		searchParams: {
			pageNum: 1,
			pageSize: 10,
			recptFlag: true,
			recptId: undefined,
			recptType: "item_use_in", // 归还入库
			statusFlag: 0,
			searchValue: ''
		},
		isNextPage: true,  //是否还有下一页
		initList: () => {
			GetStockInList(pageList.searchParams).then(res => {
				uni.stopPullDownRefresh()
				if (res.code === 200) {
					let arrs = pageList.dataList
					pageList.isNextPage = res.total <= pageList.searchParams.pageSize * pageList.searchParams.pageNum;
					pageList.dataList = [...arrs, ...res.rows]
				}
			})
		}
	})

	onMounted(() => {
		pageList.isNextPage = true
		pageList.dataList = []
		pageList.searchParams.pageNum = 1
		pageList.initList()
	})

	//上拉加载
	onReachBottom(() => {
		if (!pageList.isNextPage) {
			pageList.searchParams.pageNum += 1
			pageList.initList()
		}
	})
	//下拉刷新
	onPullDownRefresh(() => {
		pageList.searchParams.pageNum = 1
		pageList.dataList = []
		pageList.initList()
	})
</script>

<style lang="scss" scoped></style>
